package com.pang.springcloud.feignService;

import com.pang.springcloud.entities.CommonResult;
import com.pang.springcloud.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author： pang-yun
 * @date： 2022-02-11 15:54
 * Description:  与 要寻找的微服务 相同的接口  可以直接调用
 */
@Component
@FeignClient("CLOUD-PAYMENT-SERVICE")  // 需要添加微服务的名字
public interface FeignService {

    @PostMapping("/payment/add")
    CommonResult add(@RequestBody Payment payment);

    @GetMapping("/payment/get/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    @GetMapping("/payment/discovery")
    Object discovery();

    @GetMapping("/payment/loadBalances")
    String getPaymentLoadBalances();


    //进行OpenFeign 超时测试
    @GetMapping("/payment/timeout")
    public String getServerPortTimeout();

}
